package org.geekbang.thinking.in.spring.conversion;

import com.think.in.spring.ioc.overview.domain.User;
import org.springframework.beans.PropertyEditorRegistrar;
import org.springframework.beans.PropertyEditorRegistry;

/**
 *
 * 自定义 PropertyEditorRegistrar 实现
 *
 * @author : zjj
 * @date : 2022/3/7 15:43
 */
// 3 将 CustomizedPropertyEditorRegistrar 注册成 Spring Bean
public class CustomizedPropertyEditorRegistrar implements PropertyEditorRegistrar {
    @Override
    public void registerCustomEditors(PropertyEditorRegistry registry) {
        // 1 通用类型转换

        // 2 Java Bean 属性类型转换
        registry.registerCustomEditor(User.class,"context",new StringToPropertiesPropertyEditor());


    }
}
